package 排序;

import java.util.Arrays;

public class SortUtils {
    public static int[] generateArrays(int length) {
        int[] arr = new int[length];
        for (int i = 0; i < length; i++) {
            arr[i] = (int) (Math.random() * length);
        }
        System.out.println(Arrays.toString(arr));
        return arr;
    }

    public static void swap(int[] arr, int a, int b) {
        if (arr[a] == arr[b]) {
            return;
        } else {
            arr[a] = arr[a] + arr[b];
            arr[b] = arr[a] - arr[b];
            arr[a] = arr[a] - arr[b];
        }
    }

    public static void print(int[] arr) {
        for (int i : arr) {
            System.out.print(i);
        }
    }


}
